package wjc.spring.cloud.customer.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.math.BigDecimal;

/**
 * hibernate会给被管理的 pojo 加入一个 hibernateLazyInitializer 属性, jsonplugin 通过
 * java 的反射机制将 pojo 转换成 json，会把 hibernateLazyInitializer 也拿出来操作,但是
 * hibernateLazyInitializer 无法由反射得到，所以就抛异常了。
 *
 * @author: wangjunchao(王俊超)
 * @time: 2018-12-26 14:04
 **/
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "fieldHandler"})
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long       id;
    @Column
    private String     username;
    @Column
    private String     name;
    @Column
    private Integer    age;
    @Column
    private BigDecimal balance;

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return this.age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public BigDecimal getBalance() {
        return this.balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

}

